package com.zengde.chapter1.service;

import com.zengde.chapter1.model.Person;
import org.kie.api.runtime.KieSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class PersonService {
    @Autowired
    private KieSession kieSession;  // 注入规则会话

    // 执行规则匹配
    public void checkPerson(Person person) {
        kieSession.insert(person);  // 插入事实（业务数据）
        kieSession.fireAllRules();   // 触发所有规则
    }
}